package com.atguigu.gmall0218.bean.enums;

/**
 * <pre>
 *    @author  : liquid
 *    email   : xiaokui.li@guigu.com
 *    time    : 2019/9/194:11 PM
 *    desc    : 支付机构
 *    version : v1.0
 * </pre>
 */
public enum  PayOrg {
    /**
     * 支付宝支付方式
     */
    ZFB("aliPayStrategy",1),
    /**
     * 微信支付方式
     */
    WX("wxPayStrategy",2);
    private String payName;
    private Integer index;

    PayOrg(String payName, Integer index) {
        this.payName = payName;
        this.index = index;
    }

    /**
     * 根据角标获取支付机构名称
     * @param index
     * @return
     */
    public static String getName(int index) {
        for (PayOrg payOrg : PayOrg.values()) {
            if (payOrg.getIndex() == index) {
                return payOrg.payName;
            }
        }
        return null;
    }

    public String getPayName() {
        return payName;
    }

    public void setPayName(String payName) {
        this.payName = payName;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }
}
